#ifndef _ADIS16405_H_
#define _ADIS16405_H_

#include <stdint.h>
#include "board_spi.h"

#define ADIS16405_XGYRO_OUT ((uint8_t)0x04)
#define ADIS16405_YGYRO_OUT ((uint8_t)0x06)
#define ADIS16405_ZGYRO_OUT ((uint8_t)0x08)

#define ADIS16405_XACCL_OUT ((uint8_t)0x0A)
#define ADIS16405_YACCL_OUT ((uint8_t)0x0C)
#define ADIS16405_ZACCL_OUT ((uint8_t)0x0E)

#define ADIS16405_XMAGN_OUT ((uint8_t)0x10)
#define ADIS16405_YMAGN_OUT ((uint8_t)0x12)
#define ADIS16405_ZMAGN_OUT ((uint8_t)0x14)

#define ADIS16405_SMPL_PRD      ((uint8_t)0x36)
#define ADIS16405_SENS_AVG      ((uint8_t)0x38)
#define ADIS16405_SLP_CNT       ((uint8_t)0x3A)
#define ADIS16405_GLOB_CMD      ((uint8_t)0x3E)
#define ADIS16405_PRODUCT_ID    ((uint8_t)0x56)

#define ADIS16405_BURST_READ_LEN	24

struct adis16405_raw {
        int16_t gyr[3];
        int16_t acc[3];
        int16_t mag[3];
};

void adis16405_start_burst_reading(SPI_HandleTypeDef *spihandler,
				   uint8_t *pRxData);
void adis16405_byte2raw(struct adis16405_raw* raw, uint8_t* byte);

#endif
